package ucl.cs.stockBroker.common;

/**
 * StockBroker Remote Interface.
 * @author  K. Bryson.
 * @version 1.0
 */

import java.rmi.RemoteException;
import java.util.Map;

import ucl.cs.stockBroker.common.Stock;
import ucl.cs.stockBroker.exceptions.InsufficientFundsException;
import ucl.cs.stockBroker.exceptions.InsufficientStocksException;
import ucl.cs.stockBroker.exceptions.InvalidPinException;
import ucl.cs.stockBroker.exceptions.InvalidStockException;
import ucl.cs.stockBroker.exceptions.NoSuchAccountException;

public interface StockBroker extends java.rmi.Remote {

	int createAccount(String name, String pin) throws RemoteException, InvalidPinException;

	float terminateAccount(int account_number, String pin) throws RemoteException, NoSuchAccountException, InvalidPinException;

	Account getAccount(int account_number, String pin) throws RemoteException, NoSuchAccountException, InvalidPinException;

	AccountInfo[] listAccounts() throws RemoteException;

	Stock[] listStocks() throws RemoteException;

	void addStocks(Stock[] stocks) throws RemoteException;

	int internalCreateAccount(String name, String pin, float balance,
			Map<String, Integer> shares) throws RemoteException;

	void buyStocks(int account_number, String pin, String symbol,
			int unitsOfStock) throws NoSuchAccountException, InvalidPinException, RemoteException, InsufficientFundsException, InvalidStockException;

	void sellStocks(int account_number, String pin, String symbol,
			int unitsOfStock) throws NoSuchAccountException, InvalidPinException, RemoteException, InsufficientStocksException, InvalidStockException;

	Map<Integer, Account> getAccounts() throws RemoteException;

}
